package com.cui.demoshiro.controller;

import com.cui.demoshiro.pojo.RoleFunctionStatistic;
import com.cui.demoshiro.service.statistics.StatisticsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/statistic")
public class StatisticController {

    @Resource
    private StatisticsService statisticsService ;

    //点击角色功能统计跳到页面显示
    @RequestMapping("/roleFunctiontSatistic")
    @RequiresPermissions("role_function_statistic")
    public String role_function_statistic() {
        return "statistic/roleFunctiontSatistic" ;
    }

    @RequestMapping("/getRoleFunctiontSatistic")
    @RequiresPermissions("role_function_statistic")
    @ResponseBody
    public List<RoleFunctionStatistic> getRoleFunctiontSatistic() {

        List<RoleFunctionStatistic> roleFunctionStatisticList = statisticsService.getRoleFunctionCount() ;

        return roleFunctionStatisticList ;
    }
}
